#include "icon.h"

#include <stb_image.h>

#include <Windows.h>

void icon_set(SDL_Window *win, const char *path) {
	int width;
	int height;
	unsigned char *data = stbi_load(path, &width, &height, NULL, 4);

	SDL_Surface *surf = SDL_CreateRGBSurfaceFrom(data, width, height, 32, 4 * width, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);

	SDL_SetWindowIcon(win, surf);

	SDL_FreeSurface(surf);

	stbi_image_free(data);
}